class InputFormViewClassic implements InputFormView, SelectionEventExtended {
	
	private var BG_COLOR:Number=0xEFF5FC;
	private var BG_ALPHA:Number=100;
	private var BORDER_SIZE:Number=1;
	private var BORDER_COLOR:Number=0xaaaadd;
	private var BORDER_ALPHA:Number=100;
	private var ALPHA_DEBUG_MASK:Number=20;
	private var DELTA_FIELDS:Number=10; // separacion entre los fields
	private var STEP_SCROLL:Number=50;
	private var MARGIN_TOP:Number=4;
	private var MARGIN_LEFT:Number=10;
	private var BUTTON_WIDTH:Number=50;
	private var BUTTON_HEIGHT:Number=30;
	private var BUTTON_DELTA:Number=10;

	private var back:MovieClip;
	private var mask:MovieClip;
	private var mcBorde:MovieClip;
	private var labelText:TextControl;
	private var actionEvent:ActionEventExtended;
	private var actionButtons:Collection;
	
	function InputFormViewClassic(){
	reset();
	}

	public function getSeparator():Number{
	return DELTA_FIELDS;
	}
	public function setSeparator(separator:Number):Void{
	DELTA_FIELDS=separator;
	}

	public function getMask():MovieClip{
	return mask;
	};
	public function getBorder():MovieClip{
	return mcBorde;
	};
	public function getBack():MovieClip{
	return back;
	}
		
	public function getBorderSize():Number{
	return BORDER_SIZE;
	}
	public function setBorderSize(borderSize:Number):Void{
	BORDER_SIZE=borderSize;
	}
	public function getButtonHeight():Number{
	return BUTTON_HEIGHT;
	}
	public function setButtonHeight(buttonH:Number):Void{
	BUTTON_HEIGHT=buttonH;
	}
	public function getButtonDelta():Number{
	return BUTTON_DELTA;
	}
	public function setButtonDelta(buttonDelta:Number):Void{
	BUTTON_DELTA=buttonDelta;
	}

	public function getStep():Number{
	return STEP_SCROLL;
	}
	
	public function getActionButtons():Collection{
	return actionButtons;
	}

	public function actionsView(actions:Collection, container:MovieClip, actionEvent:ActionEventExtended):Void{
		var nX:Number=5;
		for(var i:Number=0;i< actions.getItems().length;i++){
			var a:Action= actions.getItems()[i].getValue();
			var btn:PressButtonControl=new PressButtonControl(container, a.getName());
			btn.setLabel(String(a.getData("label")));
			btn.setSize(new Point(BUTTON_WIDTH, BUTTON_HEIGHT));
			btn.setLocation(new Point(nX, 5));
			btn.draw();
			btn.enable();
			btn.addSelectionEvent(this);
			nX+= BUTTON_WIDTH + BUTTON_DELTA;
			actionButtons.addItem(actions.getItems()[i].getKey(), btn);
		}
		this.actionEvent=actionEvent;
	}

	public function label(container:MovieClip):TextControl{
		labelText=new TextControl(container, "titulo", new TextViewTitleClassic());
		labelText.setSize(new Point(150,20));
		labelText.setLocation(new Point(MARGIN_LEFT, MARGIN_TOP));
		labelText.draw();
		
	return labelText;
	};

	public function border(container:MovieClip):MovieClip{
		
		//Dibuja la base
		mask.removeMovieClip();
		mcBorde.removeMovieClip();
		var rect:Rectangulo= new Rectangulo(container,0,0,container.width,container.height,BG_COLOR,BG_ALPHA);
		back=rect.getClip();

		//Dibuja los bordes o los detalles de afuera.
		var borde:Rectangulo= new Rectangulo(container._parent,container._x+BORDER_SIZE,container._y+BORDER_SIZE,
		container._width-BORDER_SIZE*2,container._height-BORDER_SIZE*2,BORDER_COLOR,BORDER_ALPHA,false);
		borde.setBordes(BORDER_SIZE, BORDER_COLOR, BORDER_ALPHA, false, true);
		mcBorde=borde.getClip();
		
		//Dibuja la mascara
		var rMask:Rectangulo=new Rectangulo(container._parent,container._x+BORDER_SIZE,container._y+BORDER_SIZE, container.width,container.height-BORDER_SIZE, 0,ALPHA_DEBUG_MASK);
		mask=rMask.getClip();
		container.setMask(mask);
		
	return container;
	};
	
	public function reset():Void{
	actionButtons=new Collection();	
	};

	public function selected(){
	}
	public function selectedExtended(source:Control){
	actionEvent.actionExtended(source.getName());
	}
		
} // fin de clase